Syntax: if condition true ? then A: else B

The following is a sample program:

// SPDX-License-Identifier: SOME IDENTIFIER

pragma solidity ^0.8.10;

contract ConditionalContract {

function condition(uint a, uint b) public pure returns(uint)

{

return a > b ? 11 : 22;

}

}

The right use of the operators is essential in Solidity programming.

2.5.12 Gas and Operation Cost of Ethereum

Just like running a vehicle would need fuel, the execution of any

Solidity operation on the Ethereum network would need gas. We all

know that Ethereum is a public Blockchain that runs on the Proof of

work consensus model. Similar to Bitcoin, on the Ethereum network,

we need to allure and engage the miners to validate the transactions

by paying a fee called gas. The other advantage of the gas is that it

keeps the spammers at bay, as with each transaction, they are

spending the money from their pocket in the form of gas. Hence, it’s

well understood that more complex the transaction is, more would be

the gas price that the requester of the smart contract has to pay.

Similarly, the sooner the transaction has to be executed, the more

would be the price of the gas to be paid and vice versa. So, what

would happen if too less an amount of gas price is associated with a

transaction? Oh well, that might not allure any miner and perhaps

one has to wait for a very long time before the transaction is picked

up. Hence, as per the need of the business, the gas can be set by

the requester.

2.5.12.1 Ether